function doSuccess(res){
    if(res==null){
    	alert('出错了，请刷新页面重新尝试!');
		return;
    }
    if(typeof res.data.loginUrl!='undefined' && res.data.loginUrl!=''){
    	top.location.href	= res.data.loginUrl;
    }
    clearErrors('span', 'error_info');
    var l		= 0;
    if(typeof res.data.error_messages!='undefined'){
    	l	= res.data.error_messages.length;
    	for(var name in res.data.error_messages){
    		for(var msgname in res.data.error_messages[name]){
    			setTextMsg(name+"_info",res.data.error_messages[name][msgname]);
    			break;
    		}
    	}
    }
    if(l==0){
    	if(typeof successFun!='undefined'){
    		successFun(res);
    	}
    }
}

function doError(res){
	alert(res.responseText);
}

function doingEdit(){

}

function setTextMsg(id,msg){
	document.getElementById(id).innerHTML	= msg;
}

function clearErrors(tagName,etype){
	var arr		= document.getElementsByTagName(tagName);
	for(var i=0,l = arr.length;i<l;i++){
		var	e	= arr[i];
		if(typeof e.etype!=undefined && e.etype==etype){
			e.innerHTML	= '';
		}
	}
}